<template>
  <div class="content-box">
    <div class="padding-box">
      <div class="search-box">
        <el-form
          :inline="true"
          :model="searchFormInline"
          class="demo-form-inline"
        >
          <el-form-item>
            <el-button
              class="add-store"
              type="primary"
              :icon="Plus"
              @click="addStoreFunc"
            >
              创建店铺
            </el-button>
          </el-form-item>
          <el-form-item label="">
            <el-input
              v-model="searchFormInline.user"
              placeholder="请输入店铺名称"
              clearable
            />
          </el-form-item>
          <el-form-item label="">
            <el-date-picker
              v-model="searchFormInline.value2"
              type="daterange"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              :shortcuts="shortcuts"
            />
          </el-form-item>
          <el-form-item>
            <el-button class="search-btn" type="primary" @click="">
              查询
            </el-button>
          </el-form-item>
        </el-form>
      </div>
      <div class="table-box">
        <el-table
          :data="tableData"
          height="100%"
          stripe
          :header-cell-style="{
            color: '#828A9D',
            textAlign: 'center',
            height: '60px',
          }"
          :cell-style="{ textAlign: 'center', color: '#1B2431' }"
        >
          <el-table-column fixed prop="date" label="店铺名称" />
          <el-table-column prop="name" label="地址" />
          <el-table-column prop="state" label="创建时间" />
          <el-table-column prop="city" label="营业时间" />
          <el-table-column prop="address" label="店铺总收" />
          <el-table-column prop="zip" label="操作">
            <template #default="scope">
              <el-dropdown trigger="click">
                <el-button type="primary" link>操作</el-button>
                <template #dropdown>
                  <el-dropdown-menu>
                    <el-dropdown-item
                      @click.stop="dialogVisibleCharging = true"
                    >
                      计费管理
                    </el-dropdown-item>
                    <el-dropdown-item @click.stop="dialogVisibleDevice = true">
                      设备管理
                    </el-dropdown-item>
                    <el-dropdown-item>编辑店铺</el-dropdown-item>
                    <el-dropdown-item @click.stop="dialogVisibleBill = true">
                      流水明细
                    </el-dropdown-item>
                    <el-dropdown-item>删除店铺</el-dropdown-item>
                  </el-dropdown-menu>
                </template>
              </el-dropdown>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="pagination-box flex jc">
        <el-pagination
          v-model:page-size="searchFormInline.pageSize"
          v-model:current-page="searchFormInline.page"
          :total="searchFormInline.totalAll"
          @change="sizePageChangeFunc"
          background
          layout="total,sizes,prev, pager, next,jumper"
        />
      </div>
    </div>
  </div>
  <!-- 添加店铺 -->
  <addStoreCom
    :show="dialogVisibleStore"
    @onClose="addStoreOnCloseFunc"
  ></addStoreCom>
  <!-- 流水明细 -->
  <billCom :show="dialogVisibleBill" @onClose="billOnCloseFunc"></billCom>
  <!-- 计费管理 -->
  <chargingCom
    :show="dialogVisibleCharging"
    @onClose="dialogVisibleCharging = false"
  ></chargingCom>
  <!-- 设备管理 -->
  <stroeDviceCom
    :show="dialogVisibleDevice"
    @onClose="dialogVisibleDevice = false"
  ></stroeDviceCom>
  <!-- 地图弹窗 -->
  <!-- <txMApCom :show="dialogVisibleStore"></txMApCom> -->
</template>
<script setup>
import {
  onMounted,
  reactive,
  toRefs,
  ref,
  getCurrentInstance,
  nextTick,
} from 'vue'
import txMapApi from '@/api/txMap'
import { Plus, Position } from '@element-plus/icons-vue'
import addStoreCom from '@/components/addStoreCom/index.vue'
import txMApCom from '@/components/txMApCom/index.vue'
import billCom from '@/components/billCom/index.vue'
import chargingCom from '@/components/chargingCom/index.vue'
import stroeDviceCom from '@/components/stroeDviceCom/index.vue'
const { proxy: that } = getCurrentInstance()
onMounted(() => {})
// 设备管理
let dialogVisibleDevice = ref(false)
// 计费管理
let dialogVisibleCharging = ref(false)
// 流水明细
let dialogVisibleBill = ref(false)
const billOnCloseFunc = () => {
  dialogVisibleBill.value = false
}
// 检索
let searchFormInline = ref({
  pageSize: 10,
  page: 1,
  totalAll: 0,
})
const sizePageChangeFunc = e => {
  console.log(searchForm.value)
}
const shortcuts = [
  {
    text: '最近一周',
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
      return [start, end]
    },
  },
  {
    text: '最近一个月',
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
      return [start, end]
    },
  },
  {
    text: '最近三个月',
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
      return [start, end]
    },
  },
]
// 数据列表
let tableData = ref([
  {
    date: '2016-05-03',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-02',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-04',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-01',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
])
// 添加店铺
let dialogVisibleStore = ref(false)
const addStoreFunc = () => {
  dialogVisibleStore.value = true
}
const addStoreOnCloseFunc = () => {
  dialogVisibleStore.value = false
}
</script>
<style scoped lang="scss">
@import './index.scss';
</style>
<style lang="scss">
</style>